/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package wf3.listener;

import acceso.util.LogueoHelper;
import acceso.util.UserSesion;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 * Web application lifecycle listener.
 *
 * @author romulogalindo
 */
public class WorkflowSessionListener implements HttpSessionListener {

    @Override
    public void sessionCreated(HttpSessionEvent se) {
        System.out.println("[WorkflowSessionListener:sessionCreated][se:" + se + "][session:" + se.getSession().getId() + "][sesion.getCreationTime:" + se.getSession().getCreationTime() + "][sesion.getLastAccessedTime:" + se.getSession().getLastAccessedTime() + "][sesion.getMaxInactiveInterval:" + se.getSession().getMaxInactiveInterval() + "][sesion.isNew:" + se.getSession().isNew() + "]");
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
        System.out.println("[WorkflowSessionListener:sessionDeleted][se:" + se + "][session:" + se.getSession().getId() + "]");
        UserSesion sion = (UserSesion) se.getSession().getAttribute("US");
        LogueoHelper.actualizarEstado(sion.getId_sesion());
    }

}
